package com.egg.ylt.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.egg.ylt.R;
import com.egg.ylt.Utils.CustomUtils;
import com.egg.ylt.Utils.StatusBarUtil;
import com.egg.ylt.pojo.AppointmentServeListEntity;
import com.yonyou.framework.library.base.BaseActivity;
import com.yonyou.framework.library.bean.ErrorBean;

import butterknife.BindView;
import butterknife.OnClick;

public class ACT_AppointmentSuccess extends BaseActivity {

    @BindView(R.id.target_view_ll)
    LinearLayout mTargetViewLl;

    @BindView(R.id.shop_name_tv)
    TextView mShopNameTv;

    @BindView(R.id.shop_address_tv)
    TextView mShopAddressTv;

    @BindView(R.id.time_tv)
    TextView mTimeTv;

    @BindView(R.id.service_name_tv)
    TextView mServiceNameTv;

    @BindView(R.id.technician_tv)
    TextView mTechnicianNameTv;

    @BindView(R.id.remark_tv)
    TextView mRemarkTv;


    private AppointmentServeListEntity.ListEntity mEntity;

    @Override
    protected void getBundleExtras(Bundle extras) {
        mEntity = (AppointmentServeListEntity.ListEntity) extras.getSerializable("entity");
    }

    @Override
    protected int getContentViewLayoutID() {
        return R.layout.act_appointment_success;
    }

    @Override
    protected View getLoadingTargetView() {
        return null;
    }

    @Override
    protected void initViewsAndEvents() {

        StatusBarUtil.setStatusBarColor(this, R.color.color_FFB024);
        StatusBarUtil.StatusBarLightMode(this);
        CustomUtils.setImmersiveStatusBar(mContext, mTargetViewLl);
        mShopNameTv.setText(mEntity.getName());
        mShopAddressTv.setText(mEntity.getAddress());
        mTimeTv.setText(mEntity.getAppointmentTime());
        mServiceNameTv.setText(mEntity.getServiceName());
        mTechnicianNameTv.setText(mEntity.getTechnicianName());
        mRemarkTv.setText("备注：" + mEntity.getRemark());
    }

    @Override
    protected boolean isApplyStatusBarTranslucency() {
        return false;
    }

    @Override
    protected boolean isBindEventBusHere() {
        return false;
    }

    @Override
    protected boolean toggleOverridePendingTransition() {
        return false;
    }

    @Override
    protected TransitionMode getOverridePendingTransitionMode() {
        return null;
    }

    @Override
    protected boolean isApplyKitKatTranslucency() {
        return false;
    }

    @Override
    public void showBusinessError(ErrorBean error) {

    }

    @OnClick(value = {R.id.back_iv, R.id.back_to_home_tv, R.id.see_order_tv, R.id.shop_name_tv})
    public void toggleEvent(View view) {
        switch (view.getId()) {
            case R.id.back_to_home_tv:
                readyGo(ACT_HomePage.class, new Intent().putExtra("type", 1));
                finish();
                break;
            case R.id.back_iv:
                finish();
                break;
            case R.id.see_order_tv:
                Bundle bundle = new Bundle();
                bundle.putSerializable("entity", mEntity);
                readyGo(ACT_OrderDetail.class, bundle);
                finish();
                break;
            case R.id.shop_name_tv:
                Intent intent = new Intent();
                intent.putExtra("id", mEntity.getShopId());
                readyGo(ACT_ShopDetail.class, intent);
                break;
        }
    }

}
